﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{
    /// <summary>
    /// 班级信息
    /// </summary>
    public partial class Base_ClassInfo:BaseEntity
    {
        public string ClassId { get; set; }
        public string ClassName { get; set; }
        public int? DeleteMark { get; set; }
        public int? EnabledMark { get; set; }
        
        public int? Sort { get; set; }

        public string Remark { get; set; }
        public string CreateUserId { get; set; }
        public string CreateUserName { get; set; }
        public string ModifyUserId { get; set; }
        public string ModifyUserName { get; set; }
        public DateTime? ModifyDate { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="userName">用户名称</param>
        public override void Create(string userId, string userName)
        {
            this.ClassId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.CreateUserId = userId;
            this.CreateUserName = userName;
            this.DeleteMark = 0;
            this.EnabledMark = 1;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId">用户编号</param>
        /// <param name="userName">用户名称</param>
        public override void Modify(string userId, string userName)
        {
            this.ModifyDate = DateTime.Now;
            this.ModifyUserId = userId;
            this.ModifyUserName = userName;
        }

        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Base_ClassInfo>(entity =>
            {
                entity.HasKey(e => e.ClassId);

                entity.ToTable("Base_ClassInfo");

                entity.Property(e => e.ClassId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.ClassName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.DeleteMark).HasColumnType("int");
                entity.Property(e => e.EnabledMark).HasColumnType("int");

                entity.Property(e => e.Remark).HasColumnType("text");



                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.CreateUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyDate).HasColumnType("datetime");

                entity.Property(e => e.ModifyUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ModifyUserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

               
            });

        }
    }
}
